{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Title: #路径加密"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Difficulty: #Easy"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Category Title: #Algorithms"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Tag Slug: #string"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Name Translated: #字符串"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Solution Name: pathEncryption"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Translated Title: #路径加密"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Translated Content:\n",
    "<p>假定一段路径记作字符串 <code>path</code>，其中以 \"<code>.</code>\" 作为分隔符。现需将路径加密，加密方法为将 <code>path</code> 中的分隔符替换为空格 \"<code> </code>\"，请返回加密后的字符串。</p>\n",
    "\n",
    "<p>&nbsp;</p>\n",
    "\n",
    "<p><strong>示例 1：</strong></p>\n",
    "\n",
    "<pre>\n",
    "<strong>输入：</strong>path = \"a.aef.qerf.bb\"\n",
    "\n",
    "<strong>输出：</strong>\"a aef qerf bb\"\n",
    "\n",
    "</pre>\n",
    "\n",
    "<p>&nbsp;</p>\n",
    "\n",
    "<p><strong>限制：</strong></p>\n",
    "\n",
    "<p><code>0 &lt;= path.length&nbsp;&lt;= 10000</code></p>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Description: [ti-huan-kong-ge-lcof](https://leetcode.cn/problems/ti-huan-kong-ge-lcof/description/)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Solutions: [ti-huan-kong-ge-lcof](https://leetcode.cn/problems/ti-huan-kong-ge-lcof/solutions/)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "test_cases = ['\"a.aef.qerf.bb\"']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        res = []\n",
    "        for c in path:\n",
    "            res.append(' ' if c == '.' else c)\n",
    "        return ''.join(res)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        path = list(path)\n",
    "        for i in range(len(path)):\n",
    "            if path[i] == '.' :\n",
    "                path[i] = ' ' \n",
    "        return ''.join(path)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        a = path.replace('.', ' ')\n",
    "        return a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        path = path.replace('.',' ')\n",
    "        return path"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        return path.replace('.',' ')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        res = []\n",
    "        for i in path:\n",
    "            if i == \".\" : res.append(\" \")\n",
    "            else:res.append(i)\n",
    "        return \"\".join(res)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        return path.replace('.',' ')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        res = []\n",
    "        for c in path:\n",
    "            if c == '.': res.append(' ')\n",
    "            else: res.append(c)\n",
    "        return \"\".join(res)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        if path is None:\n",
    "            return path\n",
    "        return path.replace(\".\", \" \")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        path = list(path)\n",
    "        for i in range(len(path)):\n",
    "            if path[i] == '.' :\n",
    "                path[i] = ' ' \n",
    "        return ''.join(path)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        return path.replace('.', ' ')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        words = []\n",
    "        idx = 0\n",
    "        for i in range(len(path)):\n",
    "            if path[i] == '.':\n",
    "                words.append(path[idx:i])\n",
    "                idx = i + 1\n",
    "        words.append(path[idx:])\n",
    "        return ' '.join(words)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        str=[]\n",
    "        for i in path:\n",
    "            if i==\".\":str.append(' ')\n",
    "            else:  str.append(i)\n",
    "        return \"\".join(str)\n",
    "                "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        return \" \".join(path.split(\".\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        word_list = path.split('.')\n",
    "\n",
    "        return ' '.join(word_list)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        res = []\n",
    "        for i in range(len(path)):\n",
    "            if path[i] is '.':\n",
    "                \n",
    "                res.append(' ')\n",
    "            else:\n",
    "                res.append(path[i])\n",
    "        return ''.join(res)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        b = []\n",
    "        for c in path:\n",
    "            if c == '.':\n",
    "                b.append(' ')\n",
    "            else:\n",
    "                b.append(c)\n",
    "        return ''.join(b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        res=[]\n",
    "        for i in range(len(path)):\n",
    "            if path[i] == '.':\n",
    "                res.append(' ')\n",
    "            else:\n",
    "                res.append(path[i])\n",
    "        return ''.join(res)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        # return path.replace('.',' ')\n",
    "        return ' '.join(path.split('.'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        for i,s in enumerate(path):\n",
    "            if s == '.':\n",
    "                path = path[:i]+' '+path[i+1:]\n",
    "        return path"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        res = []\n",
    "        for c in path:\n",
    "            if c =='.' : res.append(' ')\n",
    "            else: res.append(c)\n",
    "        return \"\".join(res)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        return path.replace(\".\", \" \")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        result=\"\"\n",
    "        for i in path:\n",
    "            if i==\".\":\n",
    "                result+=\" \"\n",
    "            else:\n",
    "                result+=i\n",
    "\n",
    "        return result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        a=path.split('.')\n",
    "        \n",
    "        return ' '.join(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        path = list(path)\n",
    "        for i in range(len(path)):\n",
    "            if path[i] == '.' :\n",
    "                path[i] = ' ' \n",
    "        return ''.join(path)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        return \" \".join(path.split(\".\"))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        return path.replace('.',' ')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        #out_str=path.replace(\".\",\" \")\n",
    "        #return out_str\n",
    "        out_str=path.split(\".\")\n",
    "        return \" \".join(out_str)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        path = list(path)\n",
    "        n = len(path)\n",
    "        for i in range(n):\n",
    "            if path[i] == '.':\n",
    "                path[i] = ' '\n",
    "        return ''.join(path)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path):\n",
    "        return path.replace('.',' ')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        res = []\n",
    "        for c in path:\n",
    "            if c == '.': res.append(' ')\n",
    "            else: res.append(c)\n",
    "        return \"\".join(res)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        newpath=[]\n",
    "        for c in path:\n",
    "            if c=='.':\n",
    "                newpath.append(' ')\n",
    "            else:\n",
    "                newpath.append(c)\n",
    "        return ''.join(newpath)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "\n",
    "        return path.replace('.',' ')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        res = []\n",
    "        for c in path:\n",
    "            if c == '.': \n",
    "                res.append(' ')\n",
    "            else: \n",
    "                res.append(c)\n",
    "        return \"\".join(res)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        res = [\" \" if c == \".\" else c for c in path]\n",
    "        return \"\".join(res)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\r\n",
    "    def pathEncryption(self, path: str) -> str:\r\n",
    "        return path.replace(\".\", \" \")\r\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        res = []\n",
    "        for i in path:\n",
    "            if i == \".\":\n",
    "                res.append(\" \")\n",
    "            else:\n",
    "                res.append(i)\n",
    "                \n",
    "        return \"\".join(res)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        s = path.replace(\".\", \" \")\n",
    "        return s"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        path=path.split(\".\")\n",
    "        return \" \".join(path)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        r = path.replace(\".\", \" \")\n",
    "        return r"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        new_path = \"\"\n",
    "        for i in range(len(path)):\n",
    "            if path[i] != \".\":\n",
    "                new_path = new_path + path[i]\n",
    "            else:\n",
    "                new_path += \" \"\n",
    "        return new_path        \n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        item=path.replace('.',' ')\n",
    "        return item"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        result = ''\n",
    "        for l in path:\n",
    "            if l == '.':\n",
    "                result += ' '\n",
    "            else:\n",
    "                result += l\n",
    "        return result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        charstr = []\n",
    "        for i in path:\n",
    "            charstr.append(\" \" if i == \".\" else i)\n",
    "        return ''.join(charstr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        return path.replace('.',' ')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        res = []\n",
    "        for _ in path:\n",
    "            if _ == \".\":\n",
    "                res.append(\" \")\n",
    "            else:\n",
    "                res.append(_)\n",
    "        return \"\".join(res)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        return path.replace(\".\",\" \");\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        charstr = []\n",
    "        for i in path:\n",
    "            charstr.append(\" \" if i == \".\" else i)\n",
    "        return ''.join(charstr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        out_str=path.replace(\".\",\" \")\n",
    "        return out_str"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        ss =''\n",
    "        for i in range(len(path)):\n",
    "            if path[i] == \".\":\n",
    "                ss += \" \"\n",
    "            else: ss += path[i]    \n",
    "        return ss\n",
    "\n",
    "                "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        #out_str=path.replace(\".\",\" \")\n",
    "        #return out_str\n",
    "        out_str=path.split(\".\")\n",
    "        return \" \".join(out_str)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        n = len(path)\n",
    "        res = ''\n",
    "        for i in range(n):\n",
    "            if path[i]=='.': res+=' '\n",
    "            else:\n",
    "                res+=path[i]\n",
    "        return res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        res = ''\n",
    "        for c in path:\n",
    "            if c == '.': c = ' '\n",
    "            res += c\n",
    "        return res\n",
    "\n",
    "        # res = []\n",
    "        # for s in path:\n",
    "        #     if s == '.':\n",
    "        #         res.append(' ')\n",
    "        #     else:\n",
    "        #         res.append(s)\n",
    "        # return ''.join(res)\n",
    "        \n",
    "        # return path.replace('.', ' ')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        res = []\n",
    "        for c in path:\n",
    "            if c == '.': res.append(' ')\n",
    "            else: res.append(c)\n",
    "        return \"\".join(res)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        res=[]\n",
    "        for c in path :\n",
    "            if c==\".\":res.append(' ')\n",
    "            else :res.append(c)\n",
    "        return\"\".join(res)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        out_str=path.replace(\".\",\" \")\n",
    "        return out_str"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        res = []\n",
    "        for c in path:\n",
    "            res.append(c if c!='.' else ' ')\n",
    "        return ''.join(res)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        #out_str=path.replace(\".\",\" \")\n",
    "        #return out_str\n",
    "        out_str=path.split(\".\")\n",
    "        return \" \".join(out_str)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        result=\"\"\n",
    "        for i in range(len(path)):\n",
    "            if path[i]!=\".\":\n",
    "                result+=path[i]\n",
    "            else:\n",
    "                result+=\" \"\n",
    "        return result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        return \" \".join(path.split(\".\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        p = []\n",
    "        for i in path:\n",
    "            if i != '.':\n",
    "                p.append(i)\n",
    "            else:\n",
    "                p.append(' ')\n",
    "        res = ''.join(p)\n",
    "        return res\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        return path.replace('.',' ')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        ss =''\n",
    "        for i in path:\n",
    "            if i == \".\":\n",
    "                ss += \" \"\n",
    "            else: ss += i    \n",
    "        return ss\n",
    "\n",
    "                "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        #out_str=path.replace(\".\",\" \")\n",
    "        #return out_str\n",
    "        out_str=[]\n",
    "        for s in path:\n",
    "            if s==\".\":\n",
    "                out_str.append(\" \")\n",
    "            else:\n",
    "                out_str.append(s)\n",
    "        return \"\".join(out_str)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        path=path.replace('.',' ')\n",
    "        return path"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        ret=''\n",
    "        for i in path:\n",
    "            if i=='.':\n",
    "                ret+=' '\n",
    "            else:\n",
    "                ret+=i\n",
    "        return ret"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        res = ''\n",
    "        for i in path:\n",
    "            if i == '.':\n",
    "                res += ' '\n",
    "            else:\n",
    "                res += i\n",
    "        return res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        return path.replace('.', ' ')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        # 字符替换\n",
    "        # 思路一：调用函数\n",
    "        # return path.replace('.', ' ')\n",
    "        # 思路二：遍历替换\n",
    "        return ''.join([s if s != '.' else ' ' for s in path])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def pathEncryption(self, path: str) -> str:\n",
    "        path = path.replace('.', ' ')\n",
    "        return path"
   ]
  }
 ],
 "metadata": {},
 "nbformat": 4,
 "nbformat_minor": 2
}
